package vinnichenko.lab3.database;

import vinnichenko.lab3.exception.*;

import java.util.*;

/**Represents department table.
 * @author Igor Vinnichenko
 * @version 1.0
 */
public class DepartmentDB{
    /**Pointer to DAO*/
    private EmployeesDAO db = null;

    /**Constructor.*/
    public DepartmentDB(){
    }

    /**Set data access object.
     * @param db DAO.
     */
    public void setDatabase(EmployeesDAO db){
        this.db = db;
    }

    /**Get list with information about all departments from database.
     * @return list containing information.
     * @throws DepartmentsNotFoundException
     */
    public List<DepartmentInfo> getDepartmentsList()
        throws DepartmentsNotFoundException, DatabaseConnectException{

        return db.getDepartmentsList();
    }
}